package com.spddr.pmos.jpa;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "substation_info")
public class Substation extends PowerSystemResource {
	private static final long serialVersionUID = 1L;

	private Plant plant;
	private VoltageLevel voltageLevel;
	private Double capacity;

	public Substation() {
		super();
	}

	public Substation(Long id) {
		super(id);
	}

	public Substation(Long id, String name) {
		super(id, name);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plant", nullable = false)
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public Plant getPlant() {
		return this.plant;
	}

	public void setPlant(Plant plant) {
		this.plant = plant;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "voltage")
	@JsonSerialize(using = cn.seqdata.jackson.TypeSerializer.IdName.class)
	public VoltageLevel getVoltageLevel() {
		return this.voltageLevel;
	}

	public void setVoltageLevel(VoltageLevel voltageLevel) {
		this.voltageLevel = voltageLevel;
	}

	@Column(name = "capacity")
	public Double getCapacity() {
		return this.capacity;
	}

	public void setCapacity(Double capacity) {
		this.capacity = capacity;
	}
}